using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class systemMap : EntityTypeConfiguration<system>
    {
        public systemMap()
        {
            // Primary Key
            this.HasKey(t => new { t.currency, t.curr_left, t.pack, t.pass, t.micropass, t.telmask, t.name_type, t.ssmask });

            // Properties
            this.Property(t => t.currency)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(10);

            this.Property(t => t.pack)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.micropass)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(10);

            this.Property(t => t.telmask)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(19);

            this.Property(t => t.name_type)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.ssmask)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(19);

            // Table & Column Mappings
            this.ToTable("system");
            this.Property(t => t.currency).HasColumnName("currency");
            this.Property(t => t.curr_left).HasColumnName("curr_left");
            this.Property(t => t.pack).HasColumnName("pack");
            this.Property(t => t.pass).HasColumnName("pass");
            this.Property(t => t.micropass).HasColumnName("micropass");
            this.Property(t => t.telmask).HasColumnName("telmask");
            this.Property(t => t.name_type).HasColumnName("name_type");
            this.Property(t => t.ssmask).HasColumnName("ssmask");
        }
    }
}
